﻿//获取历史消息
var productlistpage = 0;

var productlistpageSize = 6;
var productlistpagecount = 0;
var productlistLiveId;
var isjz=0;//是否加载完成
var img = $("#progressImgage");
var mask = $("#maskOfProgressImage");
var iTotalDisplayRecords ;//总量
function get_productlist() {


	$
			.ajax({
				url : _path + "/memberCard/getmyTixianlist?pageNo="
						+ productlistpage + "&pageSize=" + productlistpageSize,
				type : "get",
				dataType : "json",
				async : false,
				error : function(request) {
					alert("连接错误！");
				},	
				complete: function(XMLHttpRequest, textStatus) {

					 img = $("#progressImgage");
					 mask = $("#maskOfProgressImage");
					img.hide();//隐藏加载图片
					mask.hide(); //隐藏加载图片
					},
				success : function(jsonMap) {
			
					var list = jsonMap.datalist;
					 iTotalDisplayRecords = jsonMap.iTotalDisplayRecords;

					if (list.length > 0) {
						for (var i = 0; i < list.length; i++) {
						
							var data = list[i];
							var msgContent='';
					 
							msgContent = "  		<li>"+
		                    "	<span class='time'>"+data.applyCash.toFixed(2)+"</span>" +
		                    "	 <span class='desc'>"+data.createTime+"</span>" +
		                    "		</li>" ;
		         
							        $("#money-list").append(msgContent);
						 
						
						}
					}
					// 分页
					var count = productlistpagecount * 6;
		 
					if (count >= iTotalDisplayRecords) {
						isjz=1;
					/*	$("#productlistload")
								.html(
										"<div class='bl_more'><span id='spancolor'>已全部加载完</span></div>");*/
					}  
				}
			});
}
function resr(po){
	if(po==0){
		return	'可提前入住';
	}else{
		return	'不可提前入住';
	}
	  
}
// 下一页
function productlistpageNext() {
 
		productlistpagecount++;
		productlistpage = productlistpage + 6;
		get_productlist(productlistLiveId);
 

}






function get_producthide(){
	
	productlistpagecount++;

	get_productlist(productlistLiveId);
}

$(function(){
	get_producthide();
$(window).scroll(function(){
	var scrollTop = $(window).scrollTop();
	var scrollHeight = document.body.scrollHeight;
	var windowHeight = document.documentElement.clientHeight;

	if (scrollTop + windowHeight >= scrollHeight) {
			//此处是滚动条到底部时候触发的事件，在这里写要加载的数据，或者是拉动滚动条的操作
		//	page = parseInt(page) + 1;//页数
		
			img.show().css({
				"position": "fixed",
				"top": "45%",
				"left": "40%",
				"margin-top": function () { return -1 * img.height() / 2; },
				"margin-left": function () { return -1 * img.width() / 2; }
			});//正在加载图标
				    	if(isjz!=1){
										productlistpageNext();
						}else{
							 $("#progressImgage").hide();//隐藏加载图片
							 $("#maskOfProgressImage").hide(); //隐藏加载图片
						}
		 
			
		
			
		
			
	}
});
});